package com.gy.api.tv.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.gy.api.base.ApiIndex;
import com.gy.api.base.R;
import com.gy.api.base.RestPage;
import com.gy.api.pc.content.domain.vo.BannerSelectListDto;
import com.gy.api.pc.content.domain.vo.BannerSelectListPageDto;
import com.gy.api.pc.content.domain.vo.BannerVO;
import com.gy.api.pc.content.service.IBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Controller
@Api( tags = ApiIndex.HuashuBannerController)
@RequestMapping("TV/system/banner")
public class HuashuBannerController {

    @Autowired
    private IBannerService bannerService;

    @GetMapping("/typeList")
    @ApiOperation(value = "banner类型查询接口")
    @ResponseBody
    public R<List<BannerVO>> typeList(BannerSelectListDto bannerList) {
        List<BannerVO> list = bannerService.selectBannerTypeList(bannerList);
        return new R(list);
    }

    @GetMapping("/list")
    @ApiOperation(value = "banner列表")
    @ResponseBody
    public R<RestPage<List<BannerVO>>> list(@ApiParam(value = "查询参数") @ModelAttribute BannerSelectListPageDto bannerList) {
        List<BannerVO> list = bannerService.selectBannerPageList(bannerList);
        RestPage restPage = new RestPage( new PageInfo(list),list);
        return new R(restPage);
    }
}
